home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / etc_-_Configuration_Files / SENDMAIL.CF < prev    next >
Text File  |  1999-09-17  |  27KB  |  1,020 lines

  1. #
  2. # Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
  3. # Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
  4. # Copyright (c) 1988, 1993
  5. #    The Regents of the University of California.  All rights reserved.
  6. #
  7. # By using this file, you agree to the terms and conditions set
  8. # forth in the LICENSE file which can be found at the top level of
  9. # the sendmail distribution.
  10. #
  11. #
  12.  
  13. ######################################################################
  14. ######################################################################
  15. #####
  16. #####        SENDMAIL CONFIGURATION FILE
  17. #####
  18. ##### built by root@zap on Tue Apr 6 23:53:30 CDT 1999
  19. ##### in /tmp/sendmail-8.9.3/cf/cf
  20. ##### using /tmp/sendmail-8.9.3/cf/ as configuration include directory
  21. #####
  22. ######################################################################
  23. ######################################################################
  24.  
  25. #####  @(#)cfhead.m4    8.23 (Berkeley) 10/6/1998  #####
  26. #####  @(#)cf.m4    8.29 (Berkeley) 5/19/1998  #####
  27.  
  28. #####  linux for smtp-only setup  #####
  29. #####  @(#)linux.m4    8.7 (Berkeley) 5/19/1998  #####
  30.  
  31.  
  32. #####  @(#)nouucp.m4    8.6 (Berkeley) 5/19/1998  #####
  33.  
  34. #####  @(#)always_add_domain.m4    8.6 (Berkeley) 5/19/1998  #####
  35.  
  36.  
  37. #####  @(#)proto.m4    8.243 (Berkeley) 2/2/1999  #####
  38.  
  39.  
  40. # level 8 config file format
  41. V8/Berkeley
  42.  
  43. # override file safeties - setting this option compromises system security
  44. # need to set this now for the sake of class files
  45. #O DontBlameSendmail=safe
  46.  
  47. ##################
  48. #   local info   #
  49. ##################
  50.  
  51. Cwlocalhost
  52.  
  53. # my official domain name
  54. # ... define this only if sendmail cannot automatically determine your domain
  55. #Dj$w.Foo.COM
  56.  
  57.  
  58. CP.
  59.  
  60. # "Smart" relay host (may be null)
  61. DS
  62.  
  63.  
  64. # operators that cannot be in local usernames (i.e., network indicators)
  65. CO @ % 
  66.  
  67. # a class with just dot (for identifying canonical names)
  68. C..
  69.  
  70. # a class with just a left bracket (for identifying domain literals)
  71. C[[
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. # Resolve map (to check if a host exists in check_mail)
  82. Kresolve host -a<OK> -T<TEMP>
  83.  
  84. # Hosts that will permit relaying ($=R)
  85. FR-o /etc/mail/relay-domains
  86.  
  87. # who I send unqualified names to (null means deliver locally)
  88. DR
  89.  
  90. # who gets all local email traffic ($R has precedence for unqualified names)
  91. DH
  92.  
  93. # dequoting map
  94. Kdequote dequote
  95.  
  96. # class E: names that should be exposed as from this host, even if we masquerade
  97. # class L: names that should be delivered locally, even if we have a relay
  98. # class M: domains that should be converted to $M
  99. #CL root
  100. CE root
  101.  
  102. # who I masquerade as (null for no masquerading) (see also $=M)
  103. DM
  104.  
  105. # my name for error messages
  106. DnMAILER-DAEMON
  107.  
  108.  
  109. # Configuration version number
  110. DZ8.9.3
  111.  
  112.  
  113. ###############
  114. #   Options   #
  115. ###############
  116.  
  117. # strip message body to 7 bits on input?
  118. O SevenBitInput=False
  119.  
  120. # 8-bit data handling
  121. O EightBitMode=pass8
  122.  
  123.  
  124. # wait for alias file rebuild (default units: minutes)
  125. O AliasWait=10
  126.  
  127. # location of alias file
  128. O AliasFile=/etc/aliases
  129.  
  130. # minimum number of free blocks on filesystem
  131. O MinFreeBlocks=100
  132.  
  133. # maximum message size
  134. #O MaxMessageSize=1000000
  135.  
  136. # substitution for space (blank) characters
  137. O BlankSub=.
  138.  
  139. # avoid connecting to "expensive" mailers on initial submission?
  140. O HoldExpensive=False
  141.  
  142. # checkpoint queue runs after every N successful deliveries
  143. #O CheckpointInterval=10
  144.  
  145. # default delivery mode
  146. O DeliveryMode=background
  147.  
  148. # automatically rebuild the alias database?
  149. #O AutoRebuildAliases
  150.  
  151. # error message header/file
  152. #O ErrorHeader=/etc/sendmail.oE
  153.  
  154. # error mode
  155. #O ErrorMode=print
  156.  
  157. # save Unix-style "From_" lines at top of header?
  158. #O SaveFromLine
  159.  
  160. # temporary file mode
  161. O TempFileMode=0600
  162.  
  163. # match recipients against GECOS field?
  164. #O MatchGECOS
  165.  
  166. # maximum hop count
  167. #O MaxHopCount=17
  168.  
  169. # location of help file
  170. O HelpFile=/usr/lib/sendmail.hf
  171.  
  172. # ignore dots as terminators in incoming messages?
  173. #O IgnoreDots
  174.  
  175. # name resolver options
  176. #O ResolverOptions=+AAONLY
  177.  
  178. # deliver MIME-encapsulated error messages?
  179. O SendMimeErrors=True
  180.  
  181. # Forward file search path
  182. O ForwardPath=$z/.forward.$w:$z/.forward
  183.  
  184. # open connection cache size
  185. O ConnectionCacheSize=2
  186.  
  187. # open connection cache timeout
  188. O ConnectionCacheTimeout=5m
  189.  
  190. # persistent host status directory
  191. #O HostStatusDirectory=.hoststat
  192.  
  193. # single thread deliveries (requires HostStatusDirectory)?
  194. #O SingleThreadDelivery
  195.  
  196. # use Errors-To: header?
  197. O UseErrorsTo=False
  198.  
  199. # log level
  200. O LogLevel=9
  201.  
  202. # send to me too, even in an alias expansion?
  203. #O MeToo
  204.  
  205. # verify RHS in newaliases?
  206. O CheckAliases=False
  207.  
  208. # default messages to old style headers if no special punctuation?
  209. O OldStyleHeaders=True
  210.  
  211. # SMTP daemon options
  212. #O DaemonPortOptions=Port=esmtp
  213.  
  214. # privacy flags
  215. O PrivacyOptions=authwarnings
  216.  
  217. # who (if anyone) should get extra copies of error messages
  218. #O PostMasterCopy=Postmaster
  219.  
  220. # slope of queue-only function
  221. #O QueueFactor=600000
  222.  
  223. # queue directory
  224. O QueueDirectory=/var/spool/mqueue
  225.  
  226. # timeouts (many of these)
  227. #O Timeout.initial=5m
  228. #O Timeout.connect=5m
  229. #O Timeout.iconnect=5m
  230. #O Timeout.helo=5m
  231. #O Timeout.mail=10m
  232. #O Timeout.rcpt=1h
  233. #O Timeout.datainit=5m
  234. #O Timeout.datablock=1h
  235. #O Timeout.datafinal=1h
  236. #O Timeout.rset=5m
  237. #O Timeout.quit=2m
  238. #O Timeout.misc=2m
  239. #O Timeout.command=1h
  240. #O Timeout.ident=30s
  241. #O Timeout.fileopen=60s
  242. O Timeout.queuereturn=5d
  243. #O Timeout.queuereturn.normal=5d
  244. #O Timeout.queuereturn.urgent=2d
  245. #O Timeout.queuereturn.non-urgent=7d
  246. O Timeout.queuewarn=4h
  247. #O Timeout.queuewarn.normal=4h
  248. #O Timeout.queuewarn.urgent=1h
  249. #O Timeout.queuewarn.non-urgent=12h
  250. #O Timeout.hoststatus=30m
  251.  
  252. # should we not prune routes in route-addr syntax addresses?
  253. #O DontPruneRoutes
  254.  
  255. # queue up everything before forking?
  256. O SuperSafe=True
  257.  
  258. # status file
  259. O StatusFile=/etc/sendmail.st
  260.  
  261. # time zone handling:
  262. #  if undefined, use system default
  263. #  if defined but null, use TZ envariable passed in
  264. #  if defined and non-null, use that info
  265. #O TimeZoneSpec=
  266.  
  267. # default UID (can be username or userid:groupid)
  268. #O DefaultUser=mailnull
  269.  
  270. # list of locations of user database file (null means no lookup)
  271. #O UserDatabaseSpec=/etc/userdb
  272.  
  273. # fallback MX host
  274. #O FallbackMXhost=fall.back.host.net
  275.  
  276. # if we are the best MX host for a site, try it directly instead of config err
  277. #O TryNullMXList
  278.  
  279. # load average at which we just queue messages
  280. #O QueueLA=8
  281.  
  282. # load average at which we refuse connections
  283. #O RefuseLA=12
  284.  
  285. # maximum number of children we allow at one time
  286. #O MaxDaemonChildren=12
  287.  
  288. # maximum number of new connections per second
  289. #O ConnectionRateThrottle=3
  290.  
  291. # work recipient factor
  292. #O RecipientFactor=30000
  293.  
  294. # deliver each queued job in a separate process?
  295. #O ForkEachJob
  296.  
  297. # work class factor
  298. #O ClassFactor=1800
  299.  
  300. # work time factor
  301. #O RetryFactor=90000
  302.  
  303. # shall we sort the queue by hostname first?
  304. #O QueueSortOrder=priority
  305.  
  306. # minimum time in queue before retry
  307. #O MinQueueAge=30m
  308.  
  309. # default character set
  310. #O DefaultCharSet=iso-8859-1
  311.  
  312. # service switch file (ignored on Solaris, Ultrix, OSF/1, others)
  313. #O ServiceSwitchFile=/etc/service.switch
  314.  
  315. # hosts file (normally /etc/hosts)
  316. #O HostsFile=/etc/hosts
  317.  
  318. # dialup line delay on connection failure
  319. #O DialDelay=10s
  320.  
  321. # action to take if there are no recipients in the message
  322. #O NoRecipientAction=add-to-undisclosed
  323.  
  324. # chrooted environment for writing to files
  325. #O SafeFileEnvironment=/arch
  326.  
  327. # are colons OK in addresses?
  328. #O ColonOkInAddr
  329.  
  330. # how many jobs can you process in the queue?
  331. #O MaxQueueRunSize=10000
  332.  
  333. # shall I avoid expanding CNAMEs (violates protocols)?
  334. #O DontExpandCnames
  335.  
  336. # SMTP initial login message (old $e macro)
  337. O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
  338.  
  339. # UNIX initial From header format (old $l macro)
  340. O UnixFromLine=From $g  $d
  341.  
  342. # From: lines that have embedded newlines are unwrapped onto one line
  343. #O SingleLineFromHeader=False
  344.  
  345. # Allow HELO SMTP command that does not include a host name
  346. #O AllowBogusHELO=False
  347.  
  348. # Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
  349. #O MustQuoteChars=.
  350.  
  351. # delimiter (operator) characters (old $o macro)
  352. O OperatorChars=.:%@!^/[]+
  353.  
  354. # shall I avoid calling initgroups(3) because of high NIS costs?
  355. #O DontInitGroups
  356.  
  357. # are group-writable :include: and .forward files (un)trustworthy?
  358. #O UnsafeGroupWrites
  359.  
  360. # where do errors that occur when sending errors get sent?
  361. #O DoubleBounceAddress=postmaster
  362.  
  363. # what user id do we assume for the majority of the processing?
  364. #O RunAsUser=sendmail
  365.  
  366. # maximum number of recipients per SMTP envelope
  367. #O MaxRecipientsPerMessage=100
  368.  
  369. # shall we get local names from our installed interfaces?
  370. #O DontProbeInterfaces
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377. ###########################
  378. #   Message precedences   #
  379. ###########################
  380.  
  381. Pfirst-class=0
  382. Pspecial-delivery=100
  383. Plist=-30
  384. Pbulk=-60
  385. Pjunk=-100
  386.  
  387. #####################
  388. #   Trusted users   #
  389. #####################
  390.  
  391. # this is equivalent to setting class "t"
  392. #Ft/etc/sendmail.ct
  393. Troot
  394. Tdaemon
  395.  
  396. #########################
  397. #   Format of headers   #
  398. #########################
  399.  
  400. H?P?Return-Path: <$g>
  401. HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
  402.     $.by $j ($v/$Z)$?r with $r$. id $i$?u
  403.     for $u; $|;
  404.     $.$b
  405. H?D?Resent-Date: $a
  406. H?D?Date: $a
  407. H?F?Resent-From: $?x$x <$g>$|$g$.
  408. H?F?From: $?x$x <$g>$|$g$.
  409. H?x?Full-Name: $x
  410. # HPosted-Date: $a
  411. # H?l?Received-Date: $b
  412. H?M?Resent-Message-Id: <$t.$i@$j>
  413. H?M?Message-Id: <$t.$i@$j>
  414. #
  415. ######################################################################
  416. ######################################################################
  417. #####
  418. #####            REWRITING RULES
  419. #####
  420. ######################################################################
  421. ######################################################################
  422.  
  423. ############################################
  424. ###  Ruleset 3 -- Name Canonicalization  ###
  425. ############################################
  426. S3
  427.  
  428. # handle null input (translate to <@> special case)
  429. R$@            $@ <@>
  430.  
  431. # strip group: syntax (not inside angle brackets!) and trailing semicolon
  432. R$*            $: $1 <@>            mark addresses
  433. R$* < $* > $* <@>    $: $1 < $2 > $3            unmark <addr>
  434. R@ $* <@>        $: @ $1                unmark @host:...
  435. R$* :: $* <@>        $: $1 :: $2            unmark node::addr
  436. R:include: $* <@>    $: :include: $1            unmark :include:...
  437. R$* [ $* : $* ] <@>    $: $1 [ $2 : $3 ]        unmark IPv6 addrs
  438. R$* : $* [ $* ]        $: $1 : $2 [ $3 ] <@>        remark if leading colon
  439. R$* : $* <@>        $: $2                strip colon if marked
  440. R$* <@>            $: $1                unmark
  441. R$* ;               $1                strip trailing semi
  442. R$* < $* ; >           $1 < $2 >            bogus bracketed semi
  443.  
  444. # null input now results from list:; syntax
  445. R$@            $@ :; <@>
  446.  
  447. # strip angle brackets -- note RFC733 heuristic to get innermost item
  448. R$*            $: < $1 >            housekeeping <>
  449. R$+ < $* >           < $2 >            strip excess on left
  450. R< $* > $+           < $1 >            strip excess on right
  451. R<>            $@ < @ >            MAIL FROM:<> case
  452. R< $+ >            $: $1                remove housekeeping <>
  453.  
  454. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  455. R@ $+ , $+        @ $1 : $2            change all "," to ":"
  456.  
  457. # localize and dispose of route-based addresses
  458. R@ $+ : $+        $@ $>96 < @$1 > : $2        handle <route-addr>
  459.  
  460. # find focus for list syntax
  461. R $+ : $* ; @ $+    $@ $>96 $1 : $2 ; < @ $3 >    list syntax
  462. R $+ : $* ;        $@ $1 : $2;            list syntax
  463.  
  464. # find focus for @ syntax addresses
  465. R$+ @ $+        $: $1 < @ $2 >            focus on domain
  466. R$+ < $+ @ $+ >        $1 $2 < @ $3 >            move gaze right
  467. R$+ < @ $+ >        $@ $>96 $1 < @ $2 >        already canonical
  468.  
  469. # do some sanity checking
  470. R$* < @ $* : $* > $*    $1 < @ $2 $3 > $4        nix colons in addrs
  471.  
  472. # if we have % signs, take the rightmost one
  473. R$* % $*        $1 @ $2                First make them all @s.
  474. R$* @ $* @ $*        $1 % $2 @ $3            Undo all but the last.
  475. R$* @ $*        $@ $>96 $1 < @ $2 >        Insert < > and finish
  476.  
  477. # else we must be a local name
  478. R$*            $@ $>96 $1
  479.  
  480.  
  481. ################################################
  482. ###  Ruleset 96 -- bottom half of ruleset 3  ###
  483. ################################################
  484.  
  485. S96
  486.  
  487. # handle special cases for local names
  488. R$* < @ localhost > $*        $: $1 < @ $j . > $2        no domain at all
  489. R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2        local domain
  490. R$* < @ [ $+ ] > $*        $: $1 < @@ [ $2 ] > $3        mark [a.b.c.d]
  491. R$* < @@ $=w > $*        $: $1 < @ $j . > $3        self-literal
  492. R$* < @@ $+ > $*        $@ $1 < @ $2 > $3        canon IP addr
  493.  
  494.  
  495.  
  496.  
  497.  
  498. # pass to name server to make hostname canonical
  499. R$* < @ $* $~P > $*        $: $1 < @ $[ $2 $3 $] > $4
  500.  
  501. # local host aliases and pseudo-domains are always canonical
  502. R$* < @ $=w > $*        $: $1 < @ $2 . > $3
  503. R$* < @ $j > $*            $: $1 < @ $j . > $2
  504. R$* < @ $=M > $*        $: $1 < @ $2 . > $3
  505. R$* < @ $* $=P > $*        $: $1 < @ $2 $3 . > $4
  506. R$* < @ $* . . > $*        $1 < @ $2 . > $3
  507.  
  508.  
  509. ##################################################
  510. ###  Ruleset 4 -- Final Output Post-rewriting  ###
  511. ##################################################
  512. S4
  513.  
  514. R$* <@>            $@                handle <> and list:;
  515.  
  516. # strip trailing dot off possibly canonical name
  517. R$* < @ $+ . > $*    $1 < @ $2 > $3
  518.  
  519. # eliminate internal code -- should never get this far!
  520. R$* < @ *LOCAL* > $*    $1 < @ $j > $2
  521.  
  522. # externalize local domain info
  523. R$* < $+ > $*        $1 $2 $3            defocus
  524. R@ $+ : @ $+ : $+    @ $1 , @ $2 : $3        <route-addr> canonical
  525. R@ $*            $@ @ $1                ... and exit
  526.  
  527.  
  528. # delete duplicate local names
  529. R$+ % $=w @ $=w        $1 @ $2                u%host@host => u@host
  530.  
  531.  
  532.  
  533. ##############################################################
  534. ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
  535. ###           (used for recursive calls)           ###
  536. ##############################################################
  537.  
  538. S97
  539. R$*            $: $>3 $1
  540. R$*            $@ $>0 $1
  541.  
  542.  
  543. ######################################
  544. ###   Ruleset 0 -- Parse Address   ###
  545. ######################################
  546.  
  547. S0
  548.  
  549. R$*            $: $>Parse0 $1        initial parsing
  550. R<@>            $#local $: <@>        special case error msgs
  551. R$*            $: $>98 $1        handle local hacks
  552. R$*            $: $>Parse1 $1        final parsing
  553.  
  554. #
  555. #  Parse0 -- do initial syntax checking and eliminate local addresses.
  556. #    This should either return with the (possibly modified) input
  557. #    or return with a #error mailer.  It should not return with a
  558. #    #mailer other than the #error mailer.
  559. #
  560.  
  561. SParse0
  562. R<@>            $@ <@>            special case error msgs
  563. R$* : $* ; <@>        $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
  564. #R@ <@ $* >        < @ $1 >        catch "@@host" bogosity
  565. R<@ $+>            $#error $@ 5.1.3 $: "User address required"
  566. R$*            $: <> $1
  567. R<> $* < @ [ $+ ] > $*    $1 < @ [ $2 ] > $3
  568. R<> $* <$* : $* > $*    $#error $@ 5.1.3 $: "Colon illegal in host name part"
  569. R<> $*            $1
  570. R$* < @ . $* > $*    $#error $@ 5.1.2 $: "Invalid host name"
  571. R$* < @ $* .. $* > $*    $#error $@ 5.1.2 $: "Invalid host name"
  572.  
  573. # now delete the local info -- note $=O to find characters that cause forwarding
  574. R$* < @ > $*        $@ $>Parse0 $>3 $1        user@ => user
  575. R< @ $=w . > : $*    $@ $>Parse0 $>3 $2        @here:... -> ...
  576. R$- < @ $=w . >        $: $(dequote $1 $) < @ $2 . >    dequote "foo"@here
  577. R< @ $+ >        $#error $@ 5.1.3 $: "User address required"
  578. R$* $=O $* < @ $=w . >    $@ $>Parse0 $>3 $1 $2 $3    ...@here -> ...
  579. R$-             $: $(dequote $1 $) < @ *LOCAL* >    dequote "foo"
  580. R< @ *LOCAL* >        $#error $@ 5.1.3 $: "User address required"
  581. R$* $=O $* < @ *LOCAL* >
  582.             $@ $>Parse0 $>3 $1 $2 $3    ...@*LOCAL* -> ...
  583. R$* < @ *LOCAL* >    $: $1
  584.  
  585. #
  586. #  Parse1 -- the bottom half of ruleset 0.
  587. #
  588.  
  589. SParse1
  590. # handle numeric address spec
  591. R$* < @ [ $+ ] > $*    $: $>98 $1 < @ [ $2 ] > $3    numeric internet spec
  592. R$* < @ [ $+ ] > $*    $#esmtp $@ [$2] $: $1 < @ [$2] > $3    still numeric: send
  593.  
  594.  
  595. # short circuit local delivery so forwarded email works
  596. R$=L < @ $=w . >    $#local $: @ $1        special local names
  597. R$+ < @ $=w . >        $#local $: $1            regular local name
  598.  
  599.  
  600.  
  601. # resolve fake top level domains by forwarding to other hosts
  602.  
  603.  
  604.  
  605. # pass names that still have a host to a smarthost (if defined)
  606. R$* < @ $* > $*        $: $>95 < $S > $1 < @ $2 > $3    glue on smarthost name
  607.  
  608. # deal with other remote names
  609. R$* < @$* > $*        $#esmtp $@ $2 $: $1 < @ $2 > $3        user@host.domain
  610.  
  611. # handle locally delivered names
  612. R$=L            $#local $: @ $1            special local names
  613. R$+            $#local $: $1            regular local names
  614.  
  615. ###########################################################################
  616. ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
  617. ###########################################################################
  618.  
  619. S5
  620.  
  621. # deal with plussed users so aliases work nicely
  622. R$+ + *            $#local $@ $&h $: $1
  623. R$+ + $*        $#local $@ + $2 $: $1 + *
  624.  
  625. # prepend an empty "forward host" on the front
  626. R$+            $: <> $1
  627.  
  628.  
  629. # see if we have a relay or a hub
  630. R< > $+            $: < $H > $1            try hub
  631. R< > $+            $: < $R > $1            try relay
  632. R< > $+            $: < > < $1 $&h >        nope, restore +detail
  633. R< > < $+ + $* > $*       < > < $1 > + $2 $3        find the user part
  634. R< > < $+ > + $*    $#local $@ $2 $: @ $1        strip the extra +
  635. R< > < $+ >        $@ $1                no +detail
  636. R$+            $: $1 <> $&h            add +detail back in
  637. R$+ <> + $*        $: $1 + $2            check whether +detail
  638. R$+ <> $*        $: $1                else discard
  639. R< local : $* > $*    $: $>95 < local : $1 > $2    no host extension
  640. R< error : $* > $*    $: $>95 < error : $1 > $2    no host extension
  641. R< $- : $+ > $+        $: $>95 < $1 : $2 > $3 < @ $2 >
  642. R< $+ > $+        $@ $>95 < $1 > $2 < @ $1 >
  643.  
  644.  
  645. ###################################################################
  646. ###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple    ###
  647. ###################################################################
  648.  
  649. S95
  650. R< > $*                $@ $1            strip off null relay
  651. R< error : $- $+ > $*        $#error $@ $(dequote $1 $) $: $2
  652. R< local : $* > $*        $>CanonLocal < $1 > $2
  653. R< $- : $+ @ $+ > $*<$*>$*    $# $1 $@ $3 $: $2<@$3>    use literal user
  654. R< $- : $+ > $*            $# $1 $@ $2 $: $3    try qualified mailer
  655. R< $=w > $*            $@ $2            delete local host
  656. R< $+ > $*            $#relay $@ $1 $: $2    use unqualified mailer
  657.  
  658. ###################################################################
  659. ###  Ruleset CanonLocal -- canonify local: syntax        ###
  660. ###################################################################
  661.  
  662. SCanonLocal
  663. # strip local host from routed addresses
  664. R< $* > < @ $+ > : $+        $@ $>97 $3
  665. R< $* > $+ $=O $+ < @ $+ >    $@ $>97 $2 $3 $4
  666.  
  667. # strip trailing dot from any host name that may appear
  668. R< $* > $* < @ $* . >        $: < $1 > $2 < @ $3 >
  669.  
  670. # handle local: syntax -- use old user, either with or without host
  671. R< > $* < @ $* > $*        $#local $@ $1@$2 $: $1
  672. R< > $+                $#local $@ $1    $: $1
  673.  
  674. # handle local:user@host syntax -- ignore host part
  675. R< $+ @ $+ > $* < @ $* >    $: < $1 > $3 < @ $4 >
  676.  
  677. # handle local:user syntax
  678. R< $+ > $* <@ $* > $*        $#local $@ $2@$3 $: $1
  679. R< $+ > $*             $#local $@ $2    $: $1
  680.  
  681. ###################################################################
  682. ###  Ruleset 93 -- convert header names to masqueraded form    ###
  683. ###################################################################
  684.  
  685. S93
  686.  
  687.  
  688. # special case the users that should be exposed
  689. R$=E < @ *LOCAL* >    $@ $1 < @ $j . >        leave exposed
  690. R$=E < @ $=M . >    $@ $1 < @ $2 . >
  691. R$=E < @ $=w . >    $@ $1 < @ $2 . >
  692.  
  693. # handle domain-specific masquerading
  694. R$* < @ $=M . > $*    $: $1 < @ $2 . @ $M > $3    convert masqueraded doms
  695. R$* < @ $=w . > $*    $: $1 < @ $2 . @ $M > $3
  696. R$* < @ *LOCAL* > $*    $: $1 < @ $j . @ $M > $2
  697. R$* < @ $+ @ > $*    $: $1 < @ $2 > $3        $M is null
  698. R$* < @ $+ @ $+ > $*    $: $1 < @ $3 . > $4        $M is not null
  699.  
  700. ###################################################################
  701. ###  Ruleset 94 -- convert envelope names to masqueraded form    ###
  702. ###################################################################
  703.  
  704. S94
  705. R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
  706.  
  707. ###################################################################
  708. ###  Ruleset 98 -- local part of ruleset zero (can be null)    ###
  709. ###################################################################
  710.  
  711. S98
  712.  
  713.  
  714.  
  715. ######################################################################
  716. ###  CanonAddr --    Convert an address into a standard form for
  717. ###            relay checking.  Route address syntax is
  718. ###            crudely converted into a %-hack address.
  719. ###
  720. ###    Parameters:
  721. ###        $1 -- full recipient address
  722. ###
  723. ###    Returns:
  724. ###        parsed address, not in source route form
  725. ######################################################################
  726.  
  727. SCanonAddr
  728. R$*            $: $>Parse0 $>3 $1    make domain canonical
  729. R< @ $+ > : $* @ $*    < @ $1 > : $2 % $3    change @ to % in src route
  730. R$* < @ $+ > : $* : $*    $3 $1 < @ $2 > : $4    change to % hack.
  731. R$* < @ $+ > : $*    $3 $1 < @ $2 >
  732.  
  733. ######################################################################
  734. ###  ParseRecipient --    Strip off hosts in $=R as well as possibly
  735. ###            $* $=m or the access database.
  736. ###            Check user portion for host separators.
  737. ###
  738. ###    Parameters:
  739. ###        $1 -- full recipient address
  740. ###
  741. ###    Returns:
  742. ###        parsed, non-local-relaying address
  743. ######################################################################
  744.  
  745. SParseRecipient
  746. R$*                $: <?> $>CanonAddr $1
  747. R<?> $* < @ $* . >        <?> $1 < @ $2 >            strip trailing dots
  748. R<?> $- < @ $* >        $: <?> $(dequote $1 $) < @ $2 >    dequote local part
  749.  
  750. # if no $=O character, no host in the user portion, we are done
  751. R<?> $* $=O $* < @ $* >        $: <NO> $1 $2 $3 < @ $4>
  752. R<?> $*                $@ $1
  753.  
  754.  
  755.  
  756. R<NO> $* < @ $* $=R >        $: <RELAY> $1 < @ $2 $3 >
  757.  
  758. R<RELAY> $* < @ $* >        $@ $>ParseRecipient $1
  759. R<$-> $*            $@ $2
  760.  
  761. ######################################################################
  762. ###  check_relay -- check hostname/address on SMTP startup
  763. ######################################################################
  764.  
  765. SLocal_check_relay
  766. Scheck_relay
  767. R$*            $: $1 $| $>"Local_check_relay" $1
  768. R$* $| $* $| $#$*    $#$3
  769. R$* $| $* $| $*        $@ $>"Basic_check_relay" $1 $| $2
  770.  
  771. SBasic_check_relay
  772. # check for deferred delivery mode
  773. R$*            $: < ${deliveryMode} > $1
  774. R< d > $*        $@ deferred
  775. R< $* > $*        $: $2
  776.  
  777.  
  778.  
  779. ######################################################################
  780. ###  check_mail -- check SMTP `MAIL FROM:' command argument
  781. ######################################################################
  782.  
  783. SLocal_check_mail
  784. Scheck_mail
  785. R$*            $: $1 $| $>"Local_check_mail" $1
  786. R$* $| $#$*        $#$2
  787. R$* $| $*        $@ $>"Basic_check_mail" $1
  788.  
  789. SBasic_check_mail
  790. # check for deferred delivery mode
  791. R$*            $: < ${deliveryMode} > $1
  792. R< d > $*        $@ deferred
  793. R< $* > $*        $: $2
  794.  
  795. R<>            $@ <OK>
  796. R$*            $: <?> $>CanonAddr $1
  797. R<?> $* < @ $+ . >    <?> $1 < @ $2 >            strip trailing dots
  798. # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
  799. R<?> $* < $* $=P > $*    $: <OK> $1 < @ $2 $3 > $4
  800. R<?> $* < @ $+ > $*    $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
  801. R<? $* <$->> $* < @ $+ > $*
  802.             $: <$2> $3 < @ $4 > $5
  803.  
  804. # handle case of @localhost on address
  805. R<$+> $* < @localhost >    $: < ? $&{client_name} > <$1> $2 < @localhost >
  806. R<$+> $* < @localhost.$m >
  807.             $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
  808. R<? $=w> <$+> $*    <?> <$2> $3
  809. R<? $+> <$+> $*        $#error $@ 5.5.4 $: "553 Real domain name required"
  810. R<?> <$+> $*        $: <$1> $2
  811.  
  812.  
  813. # handle case of no @domain on address
  814. R<?> $*            $: < ? $&{client_name} > $1
  815. R<?> $*            $@ <OK>                ...local unqualed ok
  816. R<? $+> $*        $#error $@ 5.5.4 $: "553 Domain name required"
  817.                             ...remote is not
  818. # check results
  819. R<?> $*            $@ <OK>
  820. R<OK> $*        $@ <OK>
  821. R<TEMP> $*        $#error $@ 4.1.8 $: "451 Sender domain must resolve"
  822. R<PERM> $*        $#error $@ 5.1.8 $: "501 Sender domain must exist"
  823.  
  824. ######################################################################
  825. ###  check_rcpt -- check SMTP `RCPT TO:' command argument
  826. ######################################################################
  827.  
  828. SLocal_check_rcpt
  829. Scheck_rcpt
  830. R$*            $: $1 $| $>"Local_check_rcpt" $1
  831. R$* $| $#$*        $#$2
  832. R$* $| $*        $@ $>"Basic_check_rcpt" $1
  833.  
  834. SBasic_check_rcpt
  835. # check for deferred delivery mode
  836. R$*            $: < ${deliveryMode} > $1
  837. R< d > $*        $@ deferred
  838. R< $* > $*        $: $2
  839.  
  840. R$*            $: $>ParseRecipient $1        strip relayable hosts
  841.  
  842.  
  843.  
  844.  
  845. # anything terminating locally is ok
  846. R$+ < @ $=w >        $@ OK
  847. R$+ < @ $* $=R >    $@ OK
  848.  
  849.  
  850. # check for local user (i.e. unqualified address)
  851. R$*            $: <?> $1
  852. R<?> $* < @ $+ >    $: <REMOTE> $1 < @ $2 >
  853. # local user is ok
  854. R<?> $+            $@ OK
  855. R<$+> $*        $: $2
  856.  
  857. # anything originating locally is ok
  858. R$*            $: <?> $&{client_name}
  859. # check if bracketed IP address (forward lookup != reverse lookup)
  860. R<?> [$+]        $: <BAD> [$1]
  861. # pass to name server to make hostname canonical
  862. R<?> $* $~P         $: <?> $[ $1 $2 $]
  863. R<$-> $*        $: $2
  864. R$* .            $1                strip trailing dots
  865. R$@            $@ OK
  866. R$=w            $@ OK
  867. R$* $=R            $@ OK
  868.  
  869. # check IP address
  870. R$*            $: $&{client_addr}
  871. R$@            $@ OK            originated locally
  872. R0            $@ OK            originated locally
  873. R$=R $*            $@ OK            relayable IP address
  874. R$*            $: [ $1 ]        put brackets around it...
  875. R$=w            $@ OK            ... and see if it is local
  876.  
  877.  
  878. # anything else is bogus
  879. R$*            $#error $@ 5.7.1 $: "550 Relaying denied"
  880.  
  881. #
  882. ######################################################################
  883. ######################################################################
  884. #####
  885. #####            MAILER DEFINITIONS
  886. #####
  887. ######################################################################
  888. ######################################################################
  889.  
  890.  
  891. ##################################################
  892. ###   Local and Program Mailer specification   ###
  893. ##################################################
  894.  
  895. #####  @(#)local.m4    8.30 (Berkeley) 6/30/1998  #####
  896.  
  897. Mlocal,        P=/usr/bin/procmail, F=lsDFMAw5:/|@qShP, S=10/30, R=20/40,
  898.         T=DNS/RFC822/X-Unix,
  899.         A=procmail -a $h -d $u
  900. Mprog,        P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
  901.         T=X-Unix,
  902.         A=sh -c $u
  903.  
  904. #
  905. #  Envelope sender rewriting
  906. #
  907. S10
  908. R<@>            $n            errors to mailer-daemon
  909. R@ <@ $*>        $n            temporarily bypass Sun bogosity
  910. R$+            $: $>50 $1        add local domain if needed
  911. R$*            $: $>94 $1        do masquerading
  912.  
  913. #
  914. #  Envelope recipient rewriting
  915. #
  916. S20
  917. R$+ < @ $* >        $: $1            strip host part
  918.  
  919. #
  920. #  Header sender rewriting
  921. #
  922. S30
  923. R<@>            $n            errors to mailer-daemon
  924. R@ <@ $*>        $n            temporarily bypass Sun bogosity
  925. R$+            $: $>50 $1        add local domain if needed
  926. R$*            $: $>93 $1        do masquerading
  927.  
  928. #
  929. #  Header recipient rewriting
  930. #
  931. S40
  932. R$+            $: $>50 $1        add local domain if needed
  933.  
  934. #
  935. #  Common code to add local domain name (only if always-add-domain)
  936. #
  937. S50
  938. R$* < @ $* > $*     $@ $1 < @ $2 > $3        already fully qualified
  939. R$+            $@ $1 < @ *LOCAL* >        add local qualification
  940.  
  941. #####################################
  942. ###   SMTP Mailer specification   ###
  943. #####################################
  944.  
  945. #####  @(#)smtp.m4    8.38 (Berkeley) 5/19/1998  #####
  946.  
  947. Msmtp,        P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
  948.         T=DNS/RFC822/SMTP,
  949.         A=IPC $h
  950. Mesmtp,        P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
  951.         T=DNS/RFC822/SMTP,
  952.         A=IPC $h
  953. Msmtp8,        P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
  954.         T=DNS/RFC822/SMTP,
  955.         A=IPC $h
  956. Mrelay,        P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
  957.         T=DNS/RFC822/SMTP,
  958.         A=IPC $h
  959.  
  960. #
  961. #  envelope sender rewriting
  962. #
  963. S11
  964. R$+            $: $>51 $1            sender/recipient common
  965. R$* :; <@>        $@                list:; special case
  966. R$*            $: $>61 $1            qualify unqual'ed names
  967. R$+            $: $>94 $1            do masquerading
  968.  
  969.  
  970. #
  971. #  envelope recipient rewriting --
  972. #  also header recipient if not masquerading recipients
  973. #
  974. S21
  975. R$+            $: $>51 $1            sender/recipient common
  976. R$+            $: $>61 $1            qualify unqual'ed names
  977.  
  978.  
  979. #
  980. #  header sender and masquerading header recipient rewriting
  981. #
  982. S31
  983. R$+            $: $>51 $1            sender/recipient common
  984. R:; <@>            $@                list:; special case
  985.  
  986. # do special header rewriting
  987. R$* <@> $*        $@ $1 <@> $2            pass null host through
  988. R< @ $* > $*        $@ < @ $1 > $2            pass route-addr through
  989. R$*            $: $>61 $1            qualify unqual'ed names
  990. R$+            $: $>93 $1            do masquerading
  991.  
  992.  
  993. #
  994. #  convert pseudo-domain addresses to real domain addresses
  995. #
  996. S51
  997.  
  998. # pass <route-addr>s through
  999. R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  1000.  
  1001. # output fake domains as user%fake@relay
  1002.  
  1003.  
  1004. #
  1005. #  common sender and masquerading recipient rewriting
  1006. #
  1007. S61
  1008.  
  1009. R$* < @ $* > $*        $@ $1 < @ $2 > $3        already fully qualified
  1010. R$+            $@ $1 < @ *LOCAL* >        add local qualification
  1011.  
  1012.  
  1013. #
  1014. #  relay mailer header masquerading recipient rewriting
  1015. #
  1016. S71
  1017.  
  1018. R$+            $: $>61 $1
  1019. R$+            $: $>93 $1
  1020.